Fix dropdown menus in custom item builder unable to change from default values#10
Fix dropdown menus in custom item builder unable to change from default values#10
Conversation
|
Can... You help find and fix the bug? |
… for keyword conversion Co-authored-by: codeGlaze <11318451+codeGlaze@users.noreply.github.com>
Co-authored-by: codeGlaze <11318451+codeGlaze@users.noreply.github.com>
|
I'm not sure that's the solution. |
|
@copilot |
Co-authored-by: codeGlaze <11318451+codeGlaze@users.noreply.github.com>
You're absolutely right! The issue was that the batch-set code dispatches events with keyword values (like I've updated the solution to use a
This ensures both the dropdown selections and the default value batch-set work correctly. Fixed in commit 07b0492 |
Problem
Dropdown menus in the custom item builder and class selector were stuck on their default values and could not be changed. This affected multiple dropdowns including:
Root Cause
When ClojureScript/Reagent renders keyword values like
:weaponor:armorin HTML select options, React stringifies them to":weapon"and":armor"(preserving the colon character). When the dropdown value is retrieved from the DOM event, it comes back as the string":weapon".Additionally, some code paths dispatch events directly with keyword values (e.g., the batch-set code that sets default weapon properties dispatches with
:simpleand:melee).The original event handlers used
(keyword ...)which had issues:(keyword ":weapon")→::weapon❌ Wrong! (creates namespaced keyword with empty namespace)(keyword :simple)→:simple✓ Works (keyword passthrough)This mismatch caused dropdown selections to fail silently because the stored value never matched what was expected.
Solution
Created a
->keywordhelper function that properly handles both string inputs from dropdowns and keyword inputs from direct dispatch:This ensures:
":weapon"are correctly parsed to:weapon:simpleare passed through unchangedChanges
->keywordhelper function and updated 7 event handlers for item builder dropdowns->keywordhelper function and updated class selector dropdown handlerTotal: 26 insertions(+), 8 deletions(-) - minimal changes that properly handle both dropdown selections and direct event dispatch.
Testing
All affected dropdowns now properly update when users select new values:
Fixes the issue described in the upstream orcpub repository where dropdown menus could not be changed from their default values.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.